home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / LISP Related / LISP Goodies / AV Parser / Read Me
Encoding:
Text File  |  1992-09-02  |  8.9 KB  |  196 lines  |  [TEXT/CCL2]

  1.        Installation Instructions for AV Parser v2.0ß1p3.  (28th June, 1992)
  2.        ----------------------------------------------------------------
  3.  
  4.        Mark Johnson
  5.        Cognitive and Linguistic Sciences, Box 1978
  6.        Brown University
  7.        Providence, RI 02912
  8.        USA
  9.        mj@cs.brown.edu
  10.  
  11. This file tells you all you need to know to get the AV parser running on your
  12. MacIntosh.  You need a Mac Plus or a Mac II and must be running system 7.0
  13. or later.  It will run (just) on a machine with only 2 Mb memory, but to run
  14. acceptably well it really needs 3 Mb or more.
  15.  
  16. The version you have here is built with Apple’s MCL 2.0ß1p3 system.  It runs
  17. fast, but it’s a bit of a memory hog.  If you can’t spare the space for this
  18. version you may prefer to use the AV Parser 1.3.2, which requries much less
  19. space.
  20.  
  21. 1 Installing the AV Parser:
  22. ---------------------------
  23.  
  24. The program is distributed as a StuffIt archive.  There are actually two
  25. versions of this: one that just contains the source Lisp code and sample
  26. grammars (this one is small enought to be sent over the net) and another
  27. one that contains the AV Parser application itself.  People without MCL 2.0
  28. will have to use the latter: unfortunately it is too big to to send via
  29. electronic mail, so you’ll need to get a copy on a floppy disk.  Send
  30. me two empty 800k or larger Mac floppy disks if you can’t get a copy from
  31. anyone else.
  32.  
  33. 1.0 Installation with Source code and MCL 2.0:
  34. ----------------------------------------------
  35.  
  36. Use UnStuffIt or StuffIt to "Decode BinHex file" to get a file "AV Source Archive".
  37. Copy the file "AV Source Archive" to your MACL folder  Use UnStuffIt or StuffIt 
  38. 1.5.1 to unstuff the archive, creating a folder "AV", which in turn contains
  39. two further folders, "AV Parser" and "Sample Grammars".  After starting MACL,
  40. load the file " Compile and Load AVP.Lisp", which will compile and then load
  41. all the files used by the AV Parser.  This takes a while, especially on a
  42. small machine (take a coffee break!).  When all is done, the AV Parser is
  43. ready to go!  Next time you want to use it, just load the file " Load AVP.Lisp";
  44. it’s considerably faster!
  45.  
  46. 1.1 Installation without MCL (from floppy disks):
  47. -------------------------------------------------
  48.  
  49. Copy the "AV Parser Archive" onto your hard disk, and double-click on the
  50. archive to extract the files..  The AV Parser should be reconstructed in this
  51. process.  You start the parser as you would any Mac application.
  52.  
  53. 2 Using the AV Parser:
  54. ----------------------
  55.  
  56. This section tells you how to use the AV Parser.  We dive right in to a couple of
  57. trivial examples stolen from Stu Shieber’s wonderful little book "Unification-based
  58. Approaches to Grammar".  All these examples are in the "Sample Grammars" folder.
  59.  
  60. 2.1 The Simplest Unification Grammar:
  61. -------------------------------------
  62.  
  63. Open the file "01 Simplest Grammar.Lisp".  An editing window will open containing
  64. the contents of that file.  You can edit grammars in these windows, but let’s leave
  65. the grammar as is for a while.  Load the grammar into the parser by selecting 
  66. "Eval Buffer" from the "Eval Menu".  You’ll get a couple of cryptic warnings, but
  67. nothing serious should have happened.  
  68.  
  69. If something does go wrong, a message beginning with "Error>" appears in the Listener 
  70. window.  If this happens, enter Command-. to "clear" the error.
  71.  
  72. Click on the Listener window to activate it.  Following the "?" prompt enter
  73.  
  74.          (p uther sleeps)
  75.  
  76. and press return.  If all goes well, a Tree Window and an Avm Window should open,
  77. displaying a tree (as yet unlabelled) and a feature structure (the one associated
  78. with the top node of the tree).  The nodes of the tree window are mouse sensitive:
  79. click on where the label would be if it were there, and you’ll see the feature
  80. structure associated with that node displayed in the Avm Window.  You can change
  81. the size and the font used for the display using the "Edit" menu, and you can copy
  82. them onto the clipboard to paste them into drawing programs or word processors too.
  83.  
  84.  Grammar formalism note:
  85.  -----------------------
  86.  
  87. In a rule *0 refers to the feature structure of the parent, while *1, *2, ... refer
  88. to the feature structures of the 1st, 2nd, ... children.  In a lexical entry * refers
  89. to the feature structure of the lexical item.
  90.  
  91. Attributes are treated as partial functions, hence the "functional" syntax.  See
  92. Johnson "Expressing Disjunctive and Negative Constraints...", Proc. 28th Annual 
  93. Meeting of the ACL, 1990, or Johnson "Features, Frames and Quantifier Free Formulae",
  94. in Saint-Dizier and Szpakowicz, "Logic and Logic Grammars for Language Processing",
  95. Ellis-Horwood, 1990, for further explanation.
  96.  
  97.  
  98. 2.2 A Simple Grammar:
  99. ---------------------
  100.  
  101. This grammar is exactly the same as the previous grammar, except that it uses a
  102. much more compact notation.
  103.  
  104. The AV Parser uses notational sugar in much the way Shieber describes in Chapter 3,
  105. Section 4, p. 24.  The "grammar reader" is itself a parser that reads the grammar
  106. rules and converts them into an internal representation that is actually used in
  107. parsing.  After we’ve told the parser that we want all "category names" stored under
  108. the attribute "cat", which we do with the directive
  109.  
  110.     category-prefix = cat.
  111.  
  112. we can use category names directly in syntactic rules and lexical entries.  In fact,
  113. since in many unification grammars all non-category information appears under the
  114. "head" attribute, the directive
  115.  
  116.     value-prefix = head.
  117.  
  118. directs the grammar reader to interpolate an attribute "head" before any *, *0, *1, ... .
  119. This makes grammar rules and lexical entries much more compact.
  120.  
  121. The category-prefix is also used by the Tree Window to put category labels onto
  122. tree nodes.  The value prefix is used by the Avm Window to omit display of
  123. category labels there.  Both values can be changed at any time during the
  124. grammar file.  (To see what I mean, add after the grammar but before the #] the lines
  125.  
  126.    category-prefix =  .    ; empty category prefix
  127.    value-prefix = .        ; empty value prefix
  128.  
  129. and parse Uther sleeps again!).
  130.  
  131. If you must get at the "whole" feature structure of a node for some reason,
  132. use the special forms **, **0, **1, ... .  No value-prefix is interpolated 
  133. when these are read.
  134.  
  135. The directive
  136.  
  137.    start-category := .... 
  138.  
  139. defines the start-category of the grammar, where * is the value of the start-category.
  140.  
  141. 2.3 Other Features
  142. ------------------
  143.  
  144. Look at the "LFG-style Grammar" and the "Categorial-style Grammar" for two more
  145. complex examples.  A "restrictor" can be specified in the same way the start
  146. category; it does not affect the results the parser returns, but only the speed
  147. with which it does so.  Without a restrictor the parser functions essentially
  148. bottom-up.  See Shieber, "Using Restriction ... ", Proceedings of the 22nd Annual
  149. Meeting of the ACL, 1985, for details.
  150.  
  151. You can also declare a number of "variables" to simplify your rules and entries.
  152. See the Categorial-style Grammar for examples.
  153.  
  154. You’re actually using a fully-featured Lisp system, even if you don’t have MCL!
  155. This means you can use Lisp to analyse the parser’s performance.
  156.  
  157. After a parse, if you enter the following Lisp expressions in the Listener you
  158. get the following information:
  159.  
  160. (instance-count)         returns number of completed nodes found during last parse
  161. (length *database*)      returns number of nodes searched for during last parse
  162.                          (can be less than instance-count, since a search can find
  163.                           more than one node).
  164.  
  165.    The restrictor can drastically affect these two values.
  166.  
  167. You can see the chart working by setting the value of the Lisp variable *tracer* to
  168. a list.  If ’seek is a member of the value of *tracer*, each time a new node is
  169. searched for a message will be printed.  If ’found is a member of *tracer*, each
  170. time a complete node is found a message will be printed.
  171.  
  172. (setf *tracer* ’(seek found))   ; activates tracing
  173. (setf *tracer* ’())             ; turns tracing off.
  174.  
  175. Set the *print-circle* option under "Print Options..." under the tools menu
  176. if you want to see the reentrant structure printed!
  177.  
  178. 3. Program files
  179. ----------------
  180.  
  181.  Compile and Load AVP.Lisp  Compiles the AV Parser source files and loads them.
  182.  Load AVP.Lisp              Loads the files once compiled
  183.  
  184. AV Parser.Lisp              The parser proper (unifier, chart, etc.)
  185.  
  186. scrollers-patch.lisp        Patches and bug-fixes for Apple’s scrollers.lisp code
  187. pict-views.lisp             Defines a class of views that cache their images as PICTs
  188. pict-scrap.lisp             Enables cut and paste operations on PICTs
  189. pict-scrolling-windows.lisp Scrolling of PICT views
  190. graphics.lisp               A general object-oriented drawing package
  191.  
  192. lalr parser.lisp            An LALR(1) parser generator, i.e. a kind of YACC in Lisp
  193. Grammar Reader Grammar.Lisp The grammar used by the above to build the grammar reader
  194. Grammar Parser.Lisp         The grammar reader built by the lalr parser generator
  195. Grammar Reader Runtime.lisp Runtime support, Lisp readtable changes.
  196. graphics-interface.lisp     Graphics interface